#include<stdio.h>
#include<iostream>
double sorce[1001];
double maxa,mina=10.0,all,ans;
using namespace std;
int main(){
	int man;cin>>man;
	for(int i=0;i<man;i++){
		cin>>sorce[i];
		if(sorce[i]>maxa) maxa=sorce[i];
		if(sorce[i]<mina) mina=sorce[i];
		all+=sorce[i];
	}
	ans=(all-maxa-mina)/(man-2);
	printf("%.2f",ans);

	return 0;
}

